<?php
namespace app\admin\model\auth;

use think\Model;
use think\model\relation\BelongsToMany;

class RoleModel extends Model
{
    protected $name = 'roles';
    protected $pk = 'id';
    protected $autoWriteTimestamp = 'int';
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    public function getStatusAttr($value)
    {
        return $value ? true : false;
    }


    public function menus(): BelongsToMany
    {
        return $this->belongsToMany(MenuModel::class, 'role_menu', 'menu_id', 'role_id');
    }
}